]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/Actors/Actor.cs
Protoshow sprint.
[rbdr/super-polarity] / Super Polarity / Actors / Actor.cs
index c3177962182beb92ccb8dfdf21d9d31bfada8c3b..3bb06beeedcae39694d87fb4f1e78357dddd9b9e 100644 (file)
@@ -204,13 +204,21 @@ namespace SuperPolarity
 
         public virtual void Draw(SpriteBatch spriteBatch)
         {
-            foreach (Actor child in Children)
+            Actor child = null;
+            
+            //  TODO: Check what's up with the null children.
+            if (Children == null)
             {
+                return;
+            }
+            for (var i = Children.Count - 1; i >= 0; i--)
+            {
+                child = Children[i];
                 child.Draw(spriteBatch);
             }
 
             spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f);
-            spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25));
+            //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25));
         }
 
         void CheckOutliers()
@@ -247,5 +255,13 @@ namespace SuperPolarity
         {
             Dying = true;
         }
+
+        public virtual void CleanUp()
+        {
+            Texture = null;
+            BoxTexture = null;
+            Children = null;
+            Texture = null;
+        }
     }
 }